<?php

namespace api\modules\v1\controllers\work;

use common\models\patient\User;
use Yii;
use api\controllers\OnAuthController;
use yii\web\HttpException;

class NurseReportController extends OnAuthController
{

    public $modelClass = [];

    /**
     * @author wangxiang
     * @return array
     * @throws HttpException
     */
    public function actionIndex()
    {
        $params = Yii::$app->request->get();
        $startDate = $params['start_date'] ?? '';
        $endDate = $params['end_date'] ?? '';
        if (!$startDate || !$endDate) {
            throw new HttpException(422, '开始时间和结束时间不能为空！');
        }
        $params['start_date'] = strtotime($startDate);
        $params['end_date'] = strtotime($endDate . '+1 day') - 1;
        $params['project_id'] = $this->projectId;

        return Yii::$app->services->clinicUserTreatment->getNurseReportData($params);
    }

}
